// Learn cc.Class:
//  - [Chinese] http://docs.cocos.com/creator/manual/zh/scripting/class.html
//  - [English] http://www.cocos2d-x.org/docs/creator/en/scripting/class.html
// Learn Attribute:
//  - [Chinese] http://docs.cocos.com/creator/manual/zh/scripting/reference/attributes.html
//  - [English] http://www.cocos2d-x.org/docs/creator/en/scripting/reference/attributes.html
// Learn life-cycle callbacks:
//  - [Chinese] http://docs.cocos.com/creator/manual/zh/scripting/life-cycle-callbacks.html
//  - [English] http://www.cocos2d-x.org/docs/creator/en/scripting/life-cycle-callbacks.html
/**
 * 玩法规则
 */
let base = require("panelBase")
let viewConfig = {
    btn_back:{
        node:null,
        name:"btn_back",
        eventType:"click",
        cb:"onBtnBackClick"
    },
    // 查看图鉴
    tj_title:{
        node:null,
        name:"content_bg/cake_tj/title",
    },
    tj_check:{
        node:null,
        name:"content_bg/cake_tj/btn_check",
        eventType:"click",
        cb:"onBtnCkeckClick",
    },
    // 基础玩法
    jcwf_title:{
        node:null,
        name:"content_bg/jcwf/title"
    },
    jcwf_play:{
        node:null,
        name:"content_bg/jcwf/btn_play",
        eventType:"click",
        cb:"onBtnJcwfClick"
    },
    // 进阶玩法
    jjwf_title:{
        node:null,
        name:'content_bg/jjwf/title'
    },
    jjwf_play:{
        node:null,
        name:"content_bg/jjwf/btn_play",
        eventType:"click",
        cb:"onBtnJjwfClick",
    }


};
cc.Class({
    extends: base,

    properties: {
        
    },

    init(){
        this._super(viewConfig);
        this.isInited = true;
        this.onHide();
    },
    onBtnBackClick(){
        this.onHide();
    },
    // 点击查看图鉴
    onBtnCkeckClick(){
        cc.log("on click tj ");
        cc.tg.eventCenter.dispatchEvent("showPanel",{panelName:"tj",active:true});
        this.onHide();
    },
    // 点击基础玩法
    onBtnJcwfClick(){
        cc.log("on click jichuwanfa");
        cc.tg.eventCenter.dispatchEvent("showPanel",{panelName:"strategy",active:true})
        this.onHide();
    },
    // 点击进阶玩法
    onBtnJjwfClick(){
        cc.log("on click jinjiewanfa");
        cc.tg.eventCenter.dispatchEvent("showPanel",{panelName:"strategy",active:true})
        this.onHide();
    },
    onDestroy(){
        for(let key in viewConfig)
        {
            viewConfig[key].node = null;
        }
    },

});
